package demo.designPattern;

import org.junit.Test;

public class AbsClasDemo {

    @Test
    public void test() {
        Door door = new AlarmDoor();
        door.open();
        door.close();
        door.ding();
    }

}

interface Alarm {
    void alarm();
}

abstract class Door {
    public abstract void open();

    public abstract void close();

    public void ding() {
        System.out.println("敲门");
    }
}

class AlarmDoor extends Door implements Alarm {

    @Override
    public void alarm() {
        System.out.println("报警");
    }

    @Override
    public void open() {
        System.out.println("开门");
    }

    @Override
    public void close() {
        System.out.println("关门");
    }

    @Override
    public void ding() {
//        super.ding();
        System.out.println("门铃！ding！");
    }
}